export function toast(title, duration = 1500, icon='none') {
    uni.showToast({
        title: title,
        icon: icon,
        duration: duration
    })
}

export function getTimestamp(dayDt, hours, minutes) {
    const now = new Date();
    const date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + dayDt, hours, minutes);
    return date.getTime();
}

export function getDictLabel(options,value,defaultLabel=''){
    if(this.isEmpty(value) || this.isEmpty(options)){
        return defaultLabel;
    }
    for(let option of options){
        // noinspection EqualityComparisonWithCoercionJS
        if(option['dictValue'] == value){
            return option['dictLabel'];
        }
    }
    return defaultLabel;
}

export function setTitle(title){
    uni.setNavigationBarTitle({title: title});
}

